<template>
  <div class="tab-control">
    <div class="tab-control-item" v-for="(item,index) in title" :class="{active:index == currentindex}" @click="itemclick(index)">
      <span>{{item}}</span>
    </div>
  </div>
</template>

<script>
  export default{
    props:{
      title:{
        type:Array,
        default(){
          return []
        }
      }
    },
    data(){
      return{
        currentindex:0
      }
    },
    methods:{
      itemclick(index){
        this.currentindex = index
        this.$emit('itemclick',index)
      }
    }
  }
</script>

<style>
  .tab-control{
    display: flex;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    background-color: white;
    height: 30px;
    z-index: 9;
  }
  .tab-control-item{
    flex: 1;
    padding-top:5px ;
  }
  .active{
    color: #ff5777;
  }
  .active span{
    border-bottom: 3px solid#ff8198;
    padding: 1px;
  }
</style>
